Twistpad Help   

Snippets

Introduction

Snippets are reusable blocks of code always available at your fingertips. Any text can be used as code snippet, like programs skeletons, frequent address's, javascript samples and much more.

Usage

To use Snippets in Twistpad press Ctrl-J (Please note the shortcut can easily changed to suit your needs) anywhere in the code editor and a listbox similar to auto complete pop's up. All you have to do is choose which is the snippet to use using the mouse or the keyboard and the snippet is instantly inserted at the cursor location.

Configuration

Snippets are text files which are stored in the Snippets folder in the applications file data folders with "TSF" extension. To create a new snippet simple save the new created file into the "datafolder"\snippets folder. It will be available the next time you press the "Insert Snippet" shortcut

If a syntax file have a Snippet defined in the header (or multiple separated by the | symbol) Twistpad will only use the snippets declared in the header.
In the [::Header::] section of a syntax file, the entry Snippet can be used to contain one or more snippet filenames
example:

snippet=A Sample.tsf
or multiple
Snippet=snippet1.tsf|snippet2.tsf|snippet3.tsf

File description

The Snippets file's are plain text files, so if you need to create a new one, or edit a existing one, simply open it in Twistpad! (a Special Syntax file is supplied for easier editing of snippets)

Sample Snippet file:
Snippet Title

T=Simple Snippet
This is a sample snippet

T=Snippet with hotspot
the cursor will be inserted between here ^\ and here

T=Snippet with multiple lines
Several Lines can
be added
and the formatting
will be preserved in the Twistpad editor
In the first line is where the Snippet title is, this will be used to identify a snippet file.
Each Snippet is defined by a starting T= with a sample title text.
Every line after the title will be interpreted as a the Snippet text until it finds another Snippet header or the end of file.

The hotspot can be used in two ways, if a snippets has the following symbols ^\ it means that the cursos will move to that place when inserted in Twistpad editor or, if text is selected, it will be used instead of the symbol ^\ A Snippet can omit this symbol.

Please note the space between snippets is not required and is just used to make the sample easier to read


© 1998 - 2008 Carthago Software. All rights reserved.